package start.fly.test.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import start.fly.test.database.linksql;

public class detail extends HttpServlet {

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		response.setContentType("text/html;charset=utf-8");
		PrintWriter out = response.getWriter();
		HttpSession session = request.getSession();
		request.setCharacterEncoding("utf-8");
		String username = (String) session.getAttribute("username");
		String uname = request.getParameter("uname");
		String sex = request.getParameter("sex");
		String birth = request.getParameter("birth");
		String idtype = request.getParameter("idtype");
		String id = request.getParameter("id");
		String s_province = request.getParameter("s_province");
		String s_city = request.getParameter("s_city");
		String address = request.getParameter("address");
		//String photo = (String)session.getAttribute("photo");
		String postcode = request.getParameter("postcode");
		String tele = request.getParameter("tele");
		String home = request.getParameter("home");
		String qq = (String)request.getParameter("qq");
		System.out.println(qq);
		linksql ls = new linksql();
		ls.link();
		try {
			ls.rs = ls.st.executeUpdate("update userinfo set username='"+username+"',uname='"+uname+"',sex='"+sex+"',birthday='"+birth+"',zjlb='"+idtype+"',zjhm='"+id+"',szsf='"+s_province+"',city='"+s_city+"',addr='"+address+"',yzbm='"+postcode+"',Tel='"+tele+"',homepage='"+home+"',qq='"+qq+"' where username='"+username+"'");
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		response.sendRedirect("user/detail.jsp");

	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		this.doGet(request, response);

	}

}
